package tools;
/*
 * Created on 13-Apr-06
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */


import java.util.Random;



public class Rdm {
	
	
	public static int randomInt(int _rvalue)
	{
	    java.util.Random generator = new java.util.Random();
	    int number = generator.nextInt(_rvalue);
	    return number;
	}
	

	
	public static float randomFloat()
	{
		Random rand = new Random();
		long seed = rand.nextLong();
	    
		rand = new Random(seed);

	    //java.util.Random generator = new java.util.Random();
	    float number = rand.nextFloat();
	    return number;
	}
	
	public static double randomDouble()
	{
		Random rand = new Random();
		long seed = rand.nextLong();
	    
		rand = new Random(seed);

	    //java.util.Random generator = new java.util.Random();
	    double number = rand.nextDouble();
	    return number;
	}
	
	
	public static int randomAGridCase(int _gridsize)
	{
		/* valeur de retour 0 autorisée car
		 * numéro de case 0 existe
		 */
		int dd = _gridsize * _gridsize;
		Random generator = new Random();
	    int randomized = generator.nextInt(dd);
	    return randomized;
	}
	
	public static boolean randomBoolean()
	{
		Random rand = new Random();
		long seed = rand.nextLong();
	    
		rand = new Random(seed);

	    //java.util.Random generator = new java.util.Random();
	    boolean b = rand.nextBoolean();
	    return b;
	}
	
	

}
